﻿using Entity;
using IRealize;
using Microsoft.AspNetCore.Mvc;
using Realize;

namespace WebApplication9.Controllers.Recruit_Manage.ZW
{

    public class EMR_SelectController : Controller
    {

        private readonly IConfiguration configuration;

        public EMR_SelectController(IConfiguration configuration)
        {
            this.configuration = configuration;
        }
        public IActionResult Index()
        {
            return View();
        }


        [HttpGet]
        public async Task<ActionResult> Select_EMR(int CurrentPage, int PageSize)
        {
            IEMR emr = new EMR();
            List<Engage_Major_Release> zhi = await emr.select_EMR(configuration["SqlServer"]);
            List<Engage_Major_Release> zhi2 = zhi.Skip((CurrentPage - 1) * PageSize).Take(PageSize).ToList();
            PagedViewModel<Engage_Major_Release> cc = new PagedViewModel<Engage_Major_Release>() { itemas = zhi2, total = zhi.Count };
            return Ok(new
            {
                list = cc
            });
        }

        [HttpGet]
        public async Task<ActionResult> Select_EMR2(int CurrentPage, int PageSize)
        {
            IEMR emr = new EMR();
            List<Engage_Major_Release> zhi = await emr.select_EMR(configuration["SqlServer"]);
            List<Engage_Major_Release> zhi2 = zhi.Skip((CurrentPage - 1) * PageSize).Take(PageSize).ToList();
            PagedViewModel<Engage_Major_Release> cc = new PagedViewModel<Engage_Major_Release>() { itemas = zhi2, total = zhi.Count };
            return Ok(new
            {
                list = cc
            });
        }


    }
}
